#pragma once

#include <gofcl_timer_event.h>
#include <gofcl_timer_r.h>

typedef struct {
	timer_event_s IE;
	timer_event_s DEN;
} __attribute__((aligned(2))) timer_dmainten_s;

_Static_assert(sizeof(timer_dmainten_s) == 2,
	       "Struct timer_dmainten_s defined error!");

static inline void timer_wreg_dmainten_s(timer_qe timer_q,
					 timer_dmainten_s dmainten) {
	union {
		timer_dmainten_s d;
		u16_s u;
	} cu = {
		.d = dmainten,
	};
	timer_wreg_u16(timer_q, TIMER_DMAINTEN_R, T16B_0_R, cu.u);
}
